const
path = require('path'),
fs = require('fs'),
co = require('co'),
ReactDOMServer = require('react-dom/server'),
React = require('react');

var model= require('../../model');

const IndexBundle = require("../../dist/index-server");

var data={
	words:"hello myself"
}

var BaseDir=path.resolve(__dirname,"../../view")

async function xxx(ctx,next){
	var instance=React.createElement(IndexBundle.default,data)
	var html=ReactDOMServer.renderToString(instance);
	console.log(html);
	ctx.render(BaseDir+'/index/index.pug',{content:html,rootData:JSON.stringify(data)})
}

module.exports=xxx

